import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    name:"/",
    path:"/",
    // 路由 重定向
    redirect:"/city"
  },{
    name:"city",
    path:"/city",
    component:()=>import("@/views/citys")
  },{
    name:"cityinfo",
    //定义动态路由
    path:"/city/:id",
    component:()=>import("@/views/cityInfo")
  },{
    name:"index",
    path:"/index",
    component:()=>import("@/views/index"),
    redirect:"/home",
    // 二级路由
    children:[
      {
        name:"home",
        path:"/home",
        component:()=>import('@/views/home')
      },{
        name:"search",
        path:"/search",
        component:()=>import('@/views/search')
      },{
        name:"order",
        path:"/order",
        component:()=>import('@/views/order')
      },{
        name:"mine",
        path:"/mine",
        component:()=>import('@/views/mine')
      }
    ]
  },{
    name:"cateInfo",
    path:"/cate/info",
    component:()=>import("@/views/cateInfo")
  },{
    name:"shopinfo",
    path:"/shop/info",
    component:()=>import("@/views/shopInfo")
  },{
    name:"login",
    path:"/login",
    component:()=>import("@/views/login")
  },{
    name:"profile",
    path:"/user/info",
    component:()=>import("@/views/userInfo")
  },{
    name:"conOrder",
    path:"/com/order",
    component:()=>import("@/views/comfirmOrder")
  },{
    name:"address",
    path:"/address",
    component:()=>import('@/views/chooseAdress')
  },{
    name:"addAddress",
    path:"/add/address",
    component:()=>import("@/views/addAddress")
  },{
    name:"searchAddress",
    path:"/search/address",
    component:()=>import("@/views/searchAddress")
  },{
    name:"pay",
    path:"/pay",
    component:()=>import("@/views/payment")
  }
]


const router = new VueRouter({
  routes
})

export default router
